<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
          <ipt v-model="val"></ipt>
          {{val}}
    </div>
    <template id="ipt">
        <fieldset>
            <legend>组件</legend>
            <input type="text" :value="v" @input="Ipt">
            <button>点击</button>
        </fieldset>
    </template>
    <script src='https://cdn.jsdelivr.net/npm/vue@2.7.14/dist/vue.js'></script>
    <script>
       //v-model如果作用在组件上、实现双向数据绑定的效果
       //子组件默认
        Vue.component("ipt",{
            template:"#ipt",
            props:["v"],
            methods:{
               Ipt(e){
                 this.$emit("input",e.target.value)
               }
            }
        })
         const vm = new Vue({
            el:"#app",
            data:{
                val:"100"
            },
            methods: {
                
            }
         })
    </script>
</body>
</html>